package com.zyh.controller;

import com.zyh.entity.User;
import com.zyh.service.UserService;
import com.zyh.service.impl.UserServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/user")
public class UserController {
    UserService userService = null;
    ModelAndView mav = null;
    @RequestMapping("/checkUserLoginMvc")
    public ModelAndView checkUserLoginMvc(String username,String password){
        mav = new ModelAndView();
        userService = new UserServiceImpl();
        User user = userService.selectByUsernameAndPassword(username, password);
        if(user!=null){
            mav.setViewName("/tea/selectAllTeaMvc.do");
            return mav;
        }
        mav.setViewName("redirect:/login.jsp");
        return mav;
    }
}
